<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	     <title>订单信息导入</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<link rel="stylesheet" type="text/css" href="<%=basePath%>CSS/layout.css" />
        <script type="text/javascript" src="<%=basePath%>js/jquery.js"language="javascript"></script>
          <script src='<%=basePath%>dwr/interface/reviewServices.js'></script>
          <script src="<%=basePath%>dwr/engine.js"></script>
          <script src="<%=basePath%>dwr/util.js"></script>
           <script type="text/javascript" language="javascript">
             function Import(){
               var file = "${filePath}";
               if(file=="")return;
               $("#loading").removeAttr("style");
               $("#importF").attr("disabled","disabled");
               reviewServices.ImportExcel(file,function (data){
                  alert("成功导入 "+data+" 条记录!");
                  window.location.href="order.do";
               });
             }
           </script>
  </head>
  <body>
  <div id="wrapper">
    <!--头部菜单开始-->
    <jsp:include page="/common/head.jsp"></jsp:include>
    <!--头部菜单结束-->
	<div id="BreadCrumb">我的位置：订单管理 &gt; 订单信息导入</div>
	<div id="REC_content">
	    <fieldset id="BasicInfo" class="mainField">
		    <legend><span class="title">订单信息导入</span></legend>
			<div class="innerCon">
			    <div class="mainSearchBox">
			      <form action="orderReview.do" method="post" enctype="multipart/form-data">
			       <table width="100%" cellpadding="0" cellspacing="0" border="0" class="editTab">
					<tr height="35">
						<td width="150" class="title">导入订单Excel文档</td>
						<td align="left">
                           <input type="file" name="excelFile" id="excelFile" title="浏览" value="${fileAddr}"/>
						   <input type="submit" name="searchButton" class="newSearchButton"  value="预览导入"/>
						   <img id="loading" src="img/loading.gif" style="display:none" />
						   <a href="<%=basePath%>OrderExcel/order.xls">模板下载</a>
						</td>
					</tr>
				</table>
				</form>
			    
			    </div>
			    <!-- begin tab -->
			    <div class="topControl clearfix">
				    <div id="JobsMgrTabCon" class="itemTabCon">
					    <ul id="JobsMgrTabs" class="itemTabs">
							<li id="dueTab" class="blur"><a href="<%=basePath%>order.do">订单信息管理</a></li>
							<li id="dueTab" class="focus"><a href="<%=basePath%>orderReview.do" onfocus="tdis.blur()">订单导入</a></li>
					    </ul>
				    </div>
			    </div>
			    
			    <c:if test="${not empty orderVo.orderItems}">
			    <!-- end tab -->
				<div id="mainListCon">
				    <div class="infoCon">
							<div class="info">
							  <p><b><fmt:message key="order.cmtorderid"/>:</b> ${orderVo.cmtorderid}&nbsp;&nbsp;&nbsp;&nbsp;
							     <b><fmt:message key="order.orderdate"/>:</b><fmt:formatDate value="${orderVo.orderdate}"/>&nbsp;&nbsp;&nbsp;&nbsp;
							     <b><fmt:message key="order.totalNum"/>:</b>${orderVo.totalNum}
                              </p>
                              <p><b><fmt:message key="order.fileAddr"/>：</b>${fileAddr}
                                 <input id="importF" type="button" class="newSearchButton" value="<fmt:message key="order.confirm.import"/>" onclick="Import();"/>
							  </p>
					</div>
				    <div class="tableCon">
					    <ul>
						    <li id="result">
							    <table width="100%" style="border:1px solid #eee;" cellpadding="0" cellspacing="1" border=1>
								    <tr bgcolor="#f2f6f9">
								        <th><fmt:message key="pdtOrder.trackNo"/></th>
                                        <th><fmt:message key="pdtOrder.cmtPdtId"/></th>
                                        <th><fmt:message key="pdtOrder.cmtPdtOrderId"/></th>
                                        <th><fmt:message key="pdtOrder.attribute"/></th>
                                        <th><fmt:message key="pdtOrder.arriveDate"/></th>
                                        <th><fmt:message key="pdtOrder.sendDate"/></th>
                                        <th><fmt:message key="pdtOrder.orderNum"/></th>
									</tr>
									
									<c:forEach var="order" items="${orderVo.orderItems}" varStatus="idex">
                                        <tr class="${idex.index%2==0?'list1':'list2'}">
                                         <td>${order.trackNo}</td>
                                         <td>${order.cmtpdtid}</td>
                                         <td>${order.cmtpdtorderid}</td>
                                         <td title="${order.attribute}">
                                           <c:if test="${fn:length(order.attribute)>30}">
                                             ${fn:substring(order.attribute,0,29)}......
                                           </c:if>
                                           <c:if test="${fn:length(order.attribute)<=30}">
                                             ${order.attribute}
                                           </c:if>
                                         </td>
                                         <td><fmt:formatDate value="${today}"/></td>
                                         <td><fmt:formatDate value="${order.senddate}"/></td>
                                         <td align="center">${order.ordernum}</td>
                                         </tr>
                                    </c:forEach>
								</table> 
							</li>
						</ul>
					</div>
					</div>
				</div>
				</c:if>
			</div>
		</fieldset>
	</div>
	<jsp:include page="/common/foot.jsp"></jsp:include>
</div>
   </body>
</html>
